﻿@model App.Domain.Company

@{
    System.Data.DataSet _TopViewedProducts = ViewData[AppConstants.ViewDataKeys.TOP_VIEWED_PRODUCTS] as System.Data.DataSet;   
	String pageTitle = "Company Details";
    String _Slogan = "N/A";
    String _BlankData = AppConstants.UI.BLANK_FIELD_DATA;
    if (Model != null && Model.ID > 0)
    {             
        pageTitle = Model.Name;
        _Slogan = (Model.Slogan == _BlankData) ? "Slogan: Not Given" : Model.Slogan;
    }
    ViewBag.Title = Html.GetPageTitle(pageTitle);    
}

<div class="page-heading">
    <h1>@pageTitle</h1>
    <div>
        @_Slogan
        @if (Model != null && Model.IsActive)
        {
            <div>
                <div class="float-left">
                    @Html.BuildCompanyAddress(
              (Model.Address == _BlankData) ? "NA" : Model.Address,
              (Model.District.Name == _BlankData) ? "" : Model.District.Name,
              (Model.District.Country.Name == _BlankData) ? "" : Model.District.Country.Name,
              (Model.Phone == _BlankData) ? "NA" : Model.Phone,
              (Model.Fax == _BlankData) ? "" : Model.Fax,
              (Model.Email == _BlankData) ? "" : Model.Email,
              (Model.Web == _BlankData) ? "" : Model.Web)                
                </div>
                <div class="company-logo float-right" style="margin-top:-40px;">
                    @Html.LogoThumb(Model.LogoFile, Model.ID, Model.Name, Url)
                </div>
                <div class="clear"></div>
            </div>
        }
    </div>
</div>
<div class="GroupBox">    
    @if (Model == null)
    {
        @Html.ErrorMessageBox("Requested Company Information is not available.");
    }
    else if (!Model.IsActive)
    {
        @Html.InfoMessageBox("Sorry! This Company is no longer active in " + ConfigReader.SiteName)
    }
    else
    {   
        <div class="long-text">@Model.Description</div>
        
        <div class="PropertyGroupTitle">
            <h2>Recent Products</h2>
        </div>
        @Html.Partial("_ProductList");
            
        <text>
        @section RightSideBar
        {    
            <div class="right-sidebar-container">
                <div style="border-bottom:#EFEFEF 1px solid; padding-bottom:2px; margin-bottom:10px;"><h2>Most Viewed</h2></div>
                @Html.Partial("_ProductSidebarList", _TopViewedProducts)
            </div>
        }
        </text>
    }
</div>